//
//  SellOrderViewController.m
//  Futures
//
//  Created by Cheng on 2017/7/12.
//  Copyright © 2017年 Cheng. All rights reserved.
//

#import "SellOrderViewController.h"
#import "OrderViewModel.h"

@interface SellOrderViewController () <UITableViewDelegate>{
    UIButton *_preCountBtn;
    UIButton *_prePriceBtn;
}

@end

@implementation SellOrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.delaysContentTouches = NO;
    
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}



- (IBAction)clickOrder:(id)sender {
    UIButton *btn = sender;
    MYLog(@"%@",btn.currentTitle);
    btn.backgroundColor = UICOLOR_RGB_Alpha(0x798579, 1);
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    if (_preCountBtn&&btn!= _preCountBtn) {
        _preCountBtn.backgroundColor = [UIColor blackColor];
        [_preCountBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    _preCountBtn = btn;
}

- (IBAction)clickPriceBtn:(id)sender {
    UIButton *btn = sender;
    MYLog(@"%@",btn.currentTitle);
    btn.backgroundColor = UICOLOR_RGB_Alpha(0x798579, 1);
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    if (_prePriceBtn&&btn!= _prePriceBtn) {
        _prePriceBtn.backgroundColor = [UIColor blackColor];
        [_prePriceBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    _prePriceBtn = btn;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 4) {
        return SCREEN_HEIGHT - 50*4 - 64;
    }
    return 50;
}


- (IBAction)clickBuy:(id)sender {
    // 需要登录
    [OrderViewModel requestSendOrderBuysell:@"卖出" qty:(int)_preCountBtn.tag block:^(id obj) {
        
    }];
}

@end
